<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div>hello div <b>!</b></div>
    <div class="d1">hello div <b>!</b></div>
    <div>hello div <b>!</b></div>
    <div class="d1">hello div <b>!</b></div>
    <script>
      const divs = document.querySelectorAll("div");

      console.log(divs[1].matches(".d1"));
      console.log(divs[1].matches("body div"));
      console.log(divs[1].matches("body div.d1"));
      console.log(divs[1].matches("body div#d1"));
    </script>
  </body>
</html>
